const express = require('express');
const app = express();
app.use(express.json());
app.post('/login', (req, res, next)=> {
    const { username, password } = req.body;
    console.log(req.body);
    if (username === 'gkd' && password === '123456'){
        res.end('登录成功');
    } else {
        res.end('登录失败');
    }
});


app.post('/register', (req, res, next)=> {
    const { username } = req.body;
    console.log(req.body);
    const existingUsers = ['existinguser'];
    if (existingUsers.includes(username)){
        res.end('注册成功');
    } else {
        res.end('注册失败');
    }
    });


   app.listen(9000, () => {
    console.log('Express服务器启动成功~');
   });